package com.haoze.nurse.dao;

import com.haoze.nurse.model.NurseStatisticsEntity;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface NurseStatisticsMapper {

    /**
     * 查询最近一条同类型统计记录
     * @param inpatNum 住院号
     * @param statisticsType 统计类型
     * @param nodeTime 统计节点时间
     * @return
     */
    NurseStatisticsEntity queryLastStatisticsEntity(@Param("inpatNum") String inpatNum,
                                                    @Param("statisticsType") String statisticsType,
                                                    @Param("nodeTime") Date nodeTime);

    int insert(NurseStatisticsEntity entity);

    NurseStatisticsEntity queryOne(@Param("inpatNum") String inpatNum,
                                   @Param("statisticsType") String statisticsType,
                                   @Param("endTime") String endTime);

//    int insertAfterDelete(NurseStatisticsEntity entity);

    List<NurseStatisticsEntity> queryNeedUpdateStatistics(@Param("inpatNum") String inpatNum,
                                                          @Param("nodeTime") Date nodeTime,
                                                          @Param("statisticsType") String statisticsType);

    int deleteStatistics(@Param("statisticsId") String statisticsId);

    NurseStatisticsEntity queryOneById(@Param("statisticsId") String statisticsId);

//    /**
//     * 根据当前统计id获取这条统计之后的最近一条记录用于更新
//     * @param statisticsId
//     * @return
//     */
//    NurseStatisticsEntity queryLastStatisticsEntityById(@Param("statisticsId") String statisticsId);

    int deleteStatisticsByNodeTime(@Param("inpatNum") String inpatNum,
                                   @Param("nodeTime") String nodeTime);

    List<String> queryIdByFileIndexDataId(@Param("fileIndexDataId") String fileIndexDataId);

    /**
     *
     * @param inpatNum
     * @param recordTime
     * @return
     */
    String getBedNoByTime(@Param("inpatNum") String inpatNum,@Param("recordTime") String recordTime);

    /**
     * 根据病人入院号查询当前病人信息的床号
     * @param inpatNum
     * @return
     */
    String queryBedNoByInpatNum(String inpatNum);

    /**
     * 根据入院号及时间获取最近护单的床号
     * @param inpatNum
     * @param recordTime
     * @return
     */
    String getPreNurseFileDataBedNo(String inpatNum, String recordTime);
}
